package view;

import java.util.Scanner;

public class MainView {

    public static Scanner input;

    static {
        input = new Scanner(System.in);
    }

    public static void printMenu(){
        String menu = """
                ----------------------
                       RBAC 系统
                ----------------------
                |     0...退出系统     |
                |     1...部门管理     |
                |     2...角色管理     |
                |     3...用户管理     |
                ----------------------
                请输入选项:""";
        System.out.print(menu);
    }
    public static void show(){
        String menuChoice;
        do {
            printMenu();
            menuChoice = input.nextLine();
            switch (menuChoice) {
                case "0" -> System.out.println("成功退出系统，欢迎再次使⽤！");
                case "1" -> DeptView.show();
                case "2" -> RoleView.show();
                case "3" -> UserView.show();
                default -> System.out.println("输⼊⾮法，请输⼊正确的菜单编号！");
            }
        }while (!"0".equals(menuChoice));
        input.close();
    }
}



